package com.sghd.football.utils;

import com.sghd.football.module.game.service.model.Window;

/**
 * 受管理异常
 * @author 王创辉
 */
public class ManagedException extends RuntimeException {

	private static final long serialVersionUID = -5566075318388205571L;

	/** 错误代码 */
	private final int code;
	/** 弹出窗口*/
	private Window window;

	public ManagedException(int code) {
		super();
		this.code = code;
	}

	public ManagedException(int code, String message, Throwable cause) {
		super(message, cause);
		this.code = code;
	}

	public ManagedException(int code, String message) {
		super(message);
		this.code = code;
	}
	public ManagedException(int code, Window window) {
		super(window.getContent());
		this.code = code;
		this.window = window;
	}

	public ManagedException(int code, Throwable cause) {
		super(cause);
		this.code = code;
	}

	public ManagedException(String message){
		super(message);
		this.code = -1;
	}
	public ManagedException(Window window) {
		super(window.getContent());
		this.window = window;
		this.code = -1;
	}

	/**
	 * 获取错误代码
	 * @return
	 */
	public int getCode() {
		return code;
	}

	public Window getWindow() {
		return window;
	}
}
